﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;

namespace BanHangCshap.Class.gkhtdl63.BLL
{
    public class ThuChi3BLL:DAL.ThuChi3DAL
    {
        public string TaoMa(DateTime D)
        {
            string Ma = "";
            DataTable xlDT = base.ThuChi3_Taoma(String.Format("TCC{0:0#}{1:0#}{2:0#}", D.Year, D.Month,D.Day));
            if (xlDT != null)
            {
                if (xlDT.Rows.Count > 0)
                {
                    string[] x = xlDT.Rows[0]["Ma"].ToString().Split('-');
                    Ma = x[1].ToString();
                    var xxx = Convert.ToInt32(Ma);
                    xxx++;
                    return String.Format("TCC{0}{1:0#}{2:0#}-{3:00#}", D.Year, D.Month, D.Day, xxx);
                }
                else
                    return String.Format("TCC{0}{1:0#}{2:0#}-{3:00#}", D.Year, D.Month, D.Day, 1);
            }
            else return Ma;
        }
    }
}
